<div class="bh-ly-jj-top_nav">
	<div class="bh-ly-jj-top_login bh-mR10 bh-fr">
		<?php $this->renderPartial('app.views.layouts.login');?>
	</div>
</div>
<!-- module head begin -->
	<div class="bh-ly-jj-header">
		<div class="bh-ly-jj-logo_ban bh-mLtRt10">
			<div class="bh-ly-jj-logo bh-fl"><img src="<?php echo Yii::app()->baseUrl;?>/images/ly_logo.jpg" width="200" height="70"></div>
			<div class="bh-ly-jj-bannaer  bh-Border_2 bh-fr">
            	<div class="bh-ly-jj-baner_search">
            		<form action="" method='get' class='bh-ly-jj-mall-search_form' id='index-form'>
            			<?php echo CHtml::dropDownList('type', '', 
            				array(
            					'Travel' => '旅游',
            					'Hotel' => '酒店',
            					'Scenic' => '景区',
            					'Ticket' => '票务',
            				),
            				array(
            					'id' => 'goods-type',
            					'class'=>'bh-noborder bh-input-small bh-ly-jj-mall_select bh-mlt5'
            				)
            			)?>
                    	<?php echo CHtml::textField('Goods[name]', '', array('class'=>'bh-ly-jj-mall_search bh-noborder','init-value'=>'','id'=>'goods-name'));?><input type="submit" name="mall-sub1" class="bh-ly-jj-mall_sub1 bh-noborder bh-strong" value="搜 索">
                    </form>
                   	<?php $this->widget('lib.ext.data.DataWidget',array(
						'model' => 'HotWord',
                   		'criteria' => array('limit'=>4,'order'=>'`desc` desc'),
						'view' => 'app.views.partials.keywords.mall',
					))?>
                </div>
            </div>
			<div class="bh-clear"></div>
		</div>
		<div class="bh-ly-jj-main_nav bh-mLtRt10">
			<div class="bh-ly-jj-main_navlt bh-fl"></div>
			<div class="bh-ly-jj-main_navct bh-fl">
				<?php $this->widget('lib.ext.data.DataWidget',array(
						'model' => 'NavigationArrayCopy',
						'view' => 'app.views.partials.navigation.common'
					))?>
		</div>
		<div class="bh-ly-jj-main_navrt bh-fl">
		</div>
	</div>
	</div>
<!-- module head end -->
<script type="text/javascript">
//	bindTextInit($("#goods-name"),$('#index-form'));
	$(document).ready(function() {
		var url = '<?php echo Yii::app()->createUrl('mall/{type}/goods/list')?>';
		var $form = $('#index-form');
		var $goodsType = $('#goods-type');
		var $goodsName = $('#goods-name');
		var name = 'Goods';
		$form.attr('action', url.replace('{type}',$goodsType.find(':checked').val().toLowerCase()));
		$goodsName.attr('name',goodsNameInput($goodsType.find(':checked').val()));

		$goodsType.bind('change',function() {
			value = $(this).find(':checked').val();
			$form.attr('action', url.replace('{type}',value.toLowerCase()));
			$goodsName.attr('name', goodsNameInput(value));
		});
	});

	function goodsNameInput(type) {
		switch(type) {
			case 'Hotel': return 'CompanyHotel[name]';
			case 'Travel': return 'Travel[title]';
			case 'Scenic': return 'CompanyScenic[name]';
			case 'Ticket': return 'Ticket[name]';
			default:
				return 'Goods[name]';
		}
	}
</script>